//package com.yunxitest.yunxitest.item.outScreen;
//
//import android.app.Presentation;
//import android.content.Context;
//import android.os.Bundle;
//import android.view.Display;
//import android.view.TextureView;
//import com.yunxi.streampublisher.engine.modules.Director2;
//import com.yunxi.streampublisher.engine.utils.render.SceneSurfaceRender;
//import org.greenrobot.eventbus.EventBus;
//import org.greenrobot.eventbus.Subscribe;
//import org.greenrobot.eventbus.ThreadMode;
//import java.lang.ref.WeakReference;
//
//import tv.yunxi.hostbox.R;
//import tv.yunxi.lib.event.StreamIdEvent;
//
///**
// * Created by wangkm on 2018/8/18.
// */
//
//public class DifferentDisplay extends Presentation {
//    private SceneSurfaceRender mSceneRender;
//    private TextureView mTextureView;
//
//
//    public DifferentDisplay(Context outerContext, Display display) {
//        super(outerContext, display);
//
//    }
//
//    @Override
//    protected void onCreate(Bundle savedInstanceState) {
//        super.onCreate(savedInstanceState);
//        setContentView(R.layout.layout_diffrent_screen);
//        initData();
//        initView();
//
//    }
//
//    private void initData() {
//        mSceneRender = new SceneSurfaceRender(mDirector.get());
//    }
//
//    private void initView() {
//        mTextureView = (TextureView) findViewById(R.id.tv_main_preview);
//        mTextureView.setSurfaceTextureListener(mSceneRender);
//        int textureId = mDirector.get().getShareStream(0);
//        mSceneRender.setStreamTexture(textureId);
//    }
//
//    public void setDirector(Director2 director) {
//        this.mDirector = new WeakReference(director);
//
//    }
//
//    @Subscribe(threadMode = ThreadMode.MAIN)
//    public void onPipSettingReceive(StreamIdEvent event) {
//        if (event.getType() == StreamIdEvent.Companion.getSTREAM_ID()) {
//            int textureId = mDirector.get().getShareStream(event.getStreamId());
//            mSceneRender.setStreamTexture(textureId);
//        }
//    }
//
//    @Override
//    protected void onStart() {
//        super.onStart();
//        if (!EventBus.getDefault().isRegistered(this)) {
//            EventBus.getDefault().register(this);
//        }
//    }
//
//
//    @Override
//    protected void onStop() {
//        super.onStop();
//        if (EventBus.getDefault().isRegistered(this)) EventBus.getDefault().unregister(this);
//    }
//}
